package com.download

import android.content.Context
import android.content.Intent
import okio.*
import okhttp3.*


class DownLoadManager private constructor(var context: Context) {


    companion object {
        fun create(context: Context): DownLoadManager {
            return DownLoadManager(context)
        }
    }

    /**
     * 直接在前台下载
     */
    fun downloadFile(url: String, progressListener: ProgressListener) {

    }

    /**
     * 后台service下载
     */
    fun downLoadFileBackground(url: String) {
        val intent = Intent(context, DownLoadService::class.java)
        intent.putExtra(DownLoadService.URL_KEY, url)
        context.startService(intent)
    }
}